package com.restcloud.pojo.Public;

import com.restcloud.pojo.MedicalRecordSummary.MRSReceiver;
import com.restcloud.utils.TimeUtil;
import lombok.Data;

import javax.xml.bind.annotation.*;
import java.io.Serializable;

@XmlRootElement(name = "ClinicalDocument")
@XmlAccessorType(XmlAccessType.FIELD)
@Data
public class ClinicalDocument implements Serializable {

    public ClinicalDocument(){
        //头文件信息
        this.xmlns = "urn:hl7-org:v3";
        this.xmlnsMif = "urn:hl7-org:v3/mif";
        this.xmlnsXsi = "http://www.w3.org/2001/XMLSchema-instance";
        this.xsiSchemaLocation = "urn:hl7-org:v3 ..\\sdschemas\\CDA.xsd";

        this.realmCode = new Code("CN");

        this.typeId = new Id("2.16.840.1.113883.1.3","POCD_MT000040");

        this.templateId = new Id("2.16.156.10011.2.1.1.21","");

        this.id = new Id("2.16.156.10011.1.1","RN001");

        this.code = new Code("C0001","2.16.156.10011.2.4","卫生信息共享文档规范编码体系");

        this.effectiveTime = new Value(TimeUtil.dateTime());

        Code confidentialityCode = new Code("N","2.16.840.1.113883.5.25","Confidentiality");
        confidentialityCode.setDisplayNameAttr("正常访问保密级别");
        this.confidentialityCode = confidentialityCode;

        this.languageCode = new Code("zh-CN");

        this.setId = new Id();

        this.versionNumber = new Id();
    }

    @XmlAttribute(name = "xmlns:xsi")
    private String xmlnsXsi;

    @XmlAttribute(name = "xmlns:mif")
    private String xmlnsMif;

    @XmlAttribute(name = "xsi:schemaLocation")
    private String xsiSchemaLocation;

    @XmlAttribute(name = "xmlns")
    private String xmlns;

    @XmlElement(name = "realmCode")
    private Code realmCode;

    @XmlElement(name = "typeId")
    private Id typeId;

    @XmlElement(name = "templateId")
    private Id templateId;

    @XmlElement(name = "id")
    private Id id;

    @XmlElement(name = "code")
    private Code code;

    @XmlElement(name = "title")
    private String title;

    @XmlElement(name = "effectiveTime")
    private Value effectiveTime;

    @XmlElement(name = "confidentialityCode")
    private Code confidentialityCode;

    @XmlElement(name = "languageCode")
    private Code languageCode;

    @XmlElement(name = "setId")
    private Id setId;

    @XmlElement(name = "versionNumber")
    private Id versionNumber;

    @XmlElement(name = "recordTarget")
    private MRSReceiver recordTarget;

    @XmlElement(name = "author")
    private MRSReceiver author;

    @XmlElement(name = "custodian")
    private MRSReceiver custodian;

    @XmlElement(name = "participant")
    private MRSReceiver participant;

    @XmlElement(name = "relatedDocument")
    private MRSReceiver relatedDocument;

    @XmlElement(name = "component")
    private MRSReceiver component;

}